//
//  HTTPRequestManager.h
//  TestNetWorking
//
//  Created by 蓝泰致铭 on 15/1/30.
//  Copyright (c) 2015年 蓝泰致铭. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "AFNetworking.h"

@class HTTPRequestManager;

typedef void(^HttpRequestSuccess)(HTTPRequestManager * manager, id model);         //请求成功回传数据
typedef void(^HttpRequestFailed)(HTTPRequestManager  * manager, NSError * error);  //请求失败回传错误


typedef void(^HttpRequestFailedWithRspCD)(HTTPRequestManager * manager, id model);         //请求成功回传数据

//typedef void(^HttpRequestWorking)(HTTPRequestManager * manager, id model);


@interface HTTPRequestManager : NSObject
// isRefresh后一个界面是否可以更新前面一个界面数据.  TRUE and No
@property(assign,nonatomic) BOOL isRefresh;

@property(nonatomic,strong) UIAlertView * alert;


@property (nonatomic, strong) AFHTTPRequestOperationManager * manager;

+(HTTPRequestManager *)shareInstance;

//get请求
-(void)getRequestMethodWithURL:(NSString * )url withParameters:(NSMutableDictionary*)parameters andBtn:(UIButton*)btn whenSuccess:(HttpRequestSuccess)success Faild:(HttpRequestFailed)failed;

//-(void)postRequestMethodWithURL:(NSString * )url withParameters:(NSMutableDictionary*)parameters andBtn:(UIButton*)btn whenSuccess:(HttpRequestSuccess)success Faild:(HttpRequestFailed)failed;

-(void)postRequestMethodWithURL:(NSString * )url withParameters:(NSMutableDictionary*)parameters andBtn:(UIButton*)btn whenSuccess:(HttpRequestSuccess)success RspCDFailed:(HttpRequestFailedWithRspCD)rspcdFailed Faild:(HttpRequestFailed)failed;

//取消请求
-(void)cancelAllRequest;

@end
